package com.ww.learn.lambdas

//fun walk1To(action: (Int) -> Unit, n: Int) =
//    (1..n).forEach { action(it) }

fun walk1To(n: Int, action: (Int) -> Unit) = (1..n).forEach { action(it) }

fun send(n: Int) = print(n)

fun main() {
    walk1To(5, { i -> print(i) })
    println()
    walk1To(5) { i -> print(i) }
    println()
    walk1To(5) { print(it) }
    println()
    walk1To(5, ::print)
    println()

    walk1To(5) { i -> send(i) }
    println()
    walk1To(5, ::send)
}